package xian.woniuxy.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xian.woniuxy.entity.Permission;
import xian.woniuxy.mapper.PermissionMapper;
import xian.woniuxy.service.PermissionService;

import java.util.List;

/**
 * @author gao
 * @date 2023/07/03 16:18:56
 */
@Service
@Transactional
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public int save(Permission permission) {
        return permissionMapper.insertSelective(permission);
    }

    @Override
    public int delete(Integer id) {
        return permissionMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int update(Permission permission) {
        return permissionMapper.updateByPrimaryKeySelective(permission);
    }

    @Override
    public Permission findOne(Integer id) {
        return permissionMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Permission> findAll() {
        return permissionMapper.selectByExample(null);
    }
}
